#include "droptable.h"
#include <QDebug>
#include <QDropEvent>
#include <QDragEnterEvent>
#include <QMoveEvent>

DropTable::DropTable(QWidget* parent):QTableView(parent)
{
    setAcceptDrops(true);
}

DropTable::~DropTable()
{

}

void DropTable::dragEnterEvent(QDragEnterEvent *event)
{
    event->acceptProposedAction();
    qDebug()<<"DRAG_ENTER_EVENT: "<<event->mimeData()<<" : "<<event->mimeData()->text()<<" : "<<event->mimeData()->objectName()
           <<" : "<<event->mimeData()->formats().at(0)<<" : "<<event->mimeData()->data(event->mimeData()->formats().at(0))<<" : ";
}

void DropTable::dropEvent(QDropEvent *event)
{
    qDebug()<<"Item dropped";
    event->acceptProposedAction();
    emit itemDropped(event);
}

void DropTable::dragMoveEvent(QDragMoveEvent *event)
{
    event->acceptProposedAction();
}
